<%@ page language="java" pageEncoding="UTF-8"%><!DOCTYPE html>
<html>
<head>
<title>新闻列表</title>
<jsp:include page="/admin/head.jsp"></jsp:include>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
</head>
<body>
	<jsp:include page="/admin/header.jsp"></jsp:include>
	<jsp:include page="/admin/left-menu.jsp?leftMenu=2"></jsp:include>
	<jsp:include page="/admin/footer.jsp"></jsp:include>
	
	<script type="text/javascript" src="ueditor/ueditor.config.js"></script>
	<script type="text/javascript" src="ueditor/ueditor.all.min.js"></script>

	<!-- BootstrapTable -->
	<script src="assets/plugins/bootstrap-table/bootstrap-table.min.js"
		type="text/javascript" charset="utf-8"></script>
	<script
		src="assets/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"
		type="text/javascript" charset="utf-8"></script>

	<!--中间-->
	<section>
		<nav aria-label="breadcrumb">
			<ol class="breadcrumb">
				<li class="breadcrumb-item">管理首页</li>
				<li class="breadcrumb-item">内容管理</li>
				<li class="breadcrumb-item">新闻列表</li>
				<li class="breadcrumb-item active">修改</li>
			</ol>
		</nav>
		
		
		<div class="ml-2 mr-2 card p-3 pb-0">
			<form name="addForm">
				<div class="form-group row">
					<input type="hidden" name="articleId"/>
					<label class="col-sm-2 col-form-label text-right"><b class="text-danger">*</b>文章标题</label>
					<div class="col-sm-10">
						<input name="articleTitle" type="text" required pattern="^.{2,}$"  placeholder="文章标题至少2个字符以上"   title="文章标题至少5个字符以上"  class="form-control" value="">
					</div>
				</div>
				
				<div class="form-group row">
					<div class="col-sm-12">
						<textarea id="articleContent" name="articleContent" style="height: 20em; width:100%;"></textarea>
					</div>
				</div>
				<div class="form-group row">
					<div class="col-sm-12 text-center">
						<button class="btn btn-success">修改文章</button> <button onclick="window.history.back();" type="button" class="btn btn-primary">返回</button>
					</div>
				</div>
			</form>
		</div>
	</section>
	
	<script type="text/javascript">
		var ue = UE.getEditor('articleContent');
		var form = document.forms.addForm;
		form["articleContent"].value=`${article.articleContent }`;
		form["articleId"].value="${article.articleId }";
		form["articleTitle"].value="${article.articleTitle }";
		console.info(sys.form.param(form).toString());
		
		form.onsubmit = function(event){

			$.post(
				"admin-article-update.let",
				sys.form.param(form).toString(),
				function(data){
					sys.loading.hide();
					if(data.code==200){
						sys.toastr.success("修改成功");
						form.reset();
						ue.setContent("");
					}else{
						sys.toastr.error(data.message);
					}
				},"json"
			);

			return false;
		}
		
	</script>
</body>
</html>